namespace CampDay20.Migrations
{
    using CampDay20.Models;
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;

    internal sealed class Configuration : DbMigrationsConfiguration<CampDay20.Models.ApplicationDbContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = false;
        }

        protected override void Seed(CampDay20.Models.ApplicationDbContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //
            context.Students.AddOrUpdate(s => s.Id,
                new Student() { Id = 1, FirstName = "Jeremy", LastName = "Doucet", DateCreated = DateTime.Now, Grade = GradeLevel.Sophomore },
                new Student() { Id = 2, FirstName = "David", LastName = "Graham", DateCreated = DateTime.Now, Grade = GradeLevel.Freshman },
                new Student() { Id = 3, FirstName = "Nick", LastName = "Briitain", DateCreated = DateTime.Now, Grade = GradeLevel.Sophomore, DateDeleted = DateTime.Now.AddDays(1) },
                new Student() { Id = 4, FirstName = "Isaiah", LastName = "Grey", DateCreated = DateTime.Now, Grade = GradeLevel.Doctor, DateDeleted = DateTime.Now.AddDays(2) },
                new Student() { Id = 5, FirstName = "Jacqueline", LastName = "Sloves", DateCreated = DateTime.Now, Grade = GradeLevel.Sophomore }
                );
            context.Essays.AddOrUpdate(x => x.Id,
                new Essay() { Id = 1, StudentId = 1, DateSubmitted = DateTime.Now, Grade = 90, Title = "Hello 1", Body = "Red" },
                new Essay() { Id = 2, StudentId = 1, DateSubmitted = DateTime.Now, Grade = 87, Title = "Hello 2", Body = "Blue" },
                new Essay() { Id = 3, StudentId = 2, DateSubmitted = DateTime.Now, Grade = 30, Title = "Hello 3", Body = "Purple" },
                new Essay() { Id = 4, StudentId = 2, DateSubmitted = DateTime.Now, Grade = 50, Title = "Hello 4", Body = "Orange" },
                new Essay() { Id = 5, StudentId = 2, DateSubmitted = DateTime.Now, Grade = 70, Title = "Hello 5", Body = "Brown" }
                );
        }
    }
}